home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Plug-In Power Pack for Netscape Communicator
/
Plug-In Power Pack for Netscape Communicator.iso
/
plugins
/
dataviews
/
dvtools
/
demos
/
citydemo
/
c4i_utils.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-05-08
|
3KB
|
112 lines
#ifndef lint
static char SccsId[]= "@(#)c4i_utils.c V1.9 4/17/95";
#endif
/*------------------------------------------------------------------
| file name -- c3i_utils.c
|
| functions Description
| --------- -----------
| Get_View Returns the previously or newly loaded view.
| Get_Coords Returns the screen and virtual coords of a drawport.
|
| load_view Loads a view, rebinds it and adds it to the table.
|
|-----------------------------------------------------------------*/
#include "std.h"
#include "dvstd.h"
#include "dvtools.h"
#include "Tfundecl.h"
#include "dvGR.h"
#include "c4i_vars.h"
#include "GRfundecl.h"
#include "VTfundecl.h"
#include "c4i_fundecl.h"
/***************** Begin Function Declarations *************/
LOCAL VIEW load_view V_P_((char *view_name, BOOLPARAM insert_requested));
/***************** End Function Declarations *************/
/*-----------------------------------------------------------------
|
| load_view
| Loads the view and adds it to the View Table if requested.
| Returns the loaded view. If the view can't be loaded,
| (TviLoad returned NULL), return NULL.
*/
LOCAL VIEW
load_view (view_name, insert_requested)
char *view_name;
BOOLPARAM insert_requested;
{
VIEW view = NULL;
/* Load the view and add it to the table */
view = TviLoad (view_name);
if (view)
{
if (insert_requested)
(VOID) VTstsninsert (ViewTable,
VIstrclone (view_name), (INT *) view);
/* Rebind the dyanmic object's variables to real-time data */
RebindData (view); /* found in c4i_rebind.c */
}
return view;
}
/*-----------------------------------------------------------------
|
| Get_View
| Returns the view associated with the view_name. If the
| view isn't loaded yet, load it. Add it to the ViewTable
| if requested. This routine should be called to get/load
| views that don't have their own drawports. If a view is
| being displayed in it own drawport, use GetDrawport()
*/
VIEW
Get_View (view_name, add_to_requested)
char *view_name;
BOOLPARAM add_to_requested;
{
SYMNODE key;
VIEW view;
/* See if the view is already in the Views Table */
key = VTstkeyfind (ViewTable, view_name);
if (key)
return ((VIEW) VTsnvalue (key));
/* The View must not be loaded yet, so load it */
view = load_view (view_name, add_to_requested);
return view;
}
/*-----------------------------------------------------------------
|
| GetCoords - Calculates the screen and virtural coordinates for
| the given drawing coordinates of a drawport.
|
|vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
*/
void
GetCoords (dp, dr_vp, scr_vp, virt_vp)
DRAWPORT dp;
RECTANGLE *dr_vp;
RECTANGLE *scr_vp;
RECTANGLE *virt_vp;
{
(VOID) TdpWorldToScreen (dp, &dr_vp->ll, &scr_vp->ll);
(VOID) TdpWorldToScreen (dp, &dr_vp->ur, &scr_vp->ur);
(VOID) GRscs_to_vcs (&scr_vp->ll, &virt_vp->ll);
(VOID) GRscs_to_vcs (&scr_vp->ur, &virt_vp->ur);
}
/*END GETCOORDS */